#!/usr/bin/python3

import stanza

# stanza.download('zh')

file = open('x.txt', 'r', encoding='utf-8')

content = file.read()

nlp = stanza.Pipeline('zh')
# text = "我很喜欢自然语言处理"
doc = nlp(content)
for sent in doc.sentences:
    for word in sent.words:
        print(f'{word.text}\t{word.lemma}\t{word.upos}\t{word.xpos}\t{word.feats if word.feats else "_"}\t{word.head}\t{word.deprel}\t{word.deps if word.deps else "_"}\t{word.misc}')